#include "ledconfig.h"
#include "bleuartapplication.h"
#include "debug.h"
#include "gpioconfig.h"

extern uint8_t count;
extern uint8_t bleReceiveState;

void Led1Callback(uint8_t *p,uint8_t len)
{
    if (len != 1) {
        printf("Length Error");
    }
    if (*p == 1 || *p == 0) {
        GPIO_WriteBit(GPIOA, GPIO_LED1, *p);
    } else {
        printf("Unknow Type");
    }
}

void Led2Callback(uint8_t *p,uint8_t len)
{
    if (len != 1) {
        printf("Length Error");
    }
    if (*p == 1 || *p == 0) {
        GPIO_WriteBit(GPIOA, GPIO_LED2, *p);
    } else {
        printf("Unknow Type");
    }
}

//void BleReceiverDataParse(void)
//{
//    if (bleReceiveState == 1) {
//        bleReceiveState = 0;
//        switch (BleRxData[1]) {
//            case TYPE_LED1:
//                Led1Callback(&BleRxData[3],BleRxData[2]);
//                break;
//            case TYPE_LED2:
//                Led2Callback(&BleRxData[3],BleRxData[2]);
//                break;
//            default:
//                printf("Type Error\r\n");
//                break;
//        }
//    }
//}
